define(['app',
  'toolkit',
  'services',
  'controllers',
  'app.route',
  'app.config'],function(app){
  app.run(['$ionicPlatform',function($ionicPlatform) {
    $ionicPlatform.ready(function() {
      // Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
      // for form inputs)
      if (window.cordova && window.cordova.plugins && window.cordova.plugins.Keyboard) {
        cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
        cordova.plugins.Keyboard.disableScroll(true);

      }
      if (window.StatusBar) {
        // org.apache.cordova.statusbar required
        StatusBar.styleDefault();
      }
    });
  }]);
  app.run(['globalConfig','$rootScope',function(globalConfig,$rootScope){
    globalConfig.rootScope = $rootScope;
    initApiUrl();
    /**
     * 全局 Web Api 的路径定义
     */
    function initApiUrl(){
      /*var webApiAuth = 'http://auth.my.me';
       var webApiCompany = 'http://company.my.me';*/
      var webApiAuth = 'http://192.168.1.108:2111';
      var webApiCompany = 'http://192.168.1.108:3111';
      var webApiCustomer = 'http://192.168.1.108:4111';

      globalConfig.apiUrl = {
        token: webApiAuth + '/authentication/token',   // 用户验证
        // 账号相关的API
        account: {
          getSmsSecurityCode: webApiCompany + "/NonBusiness/SmsCode/{0}?code={1}",
          registerCompany: webApiCompany + "/Company",
          registerMember:webApiCompany+"/Company/{0}/Member",
          exitMember:webApiCompany+"/Company/{0}/Member/{1}",
          getMyInfo:webApiCompany+"/Member/me"
        },
        //公司管理的API
        company:{
          getDepartmentList:webApiCompany+"/Company/{0}/department/tree",
          getCompanySimpleInfor:webApiCompany+"/Company/{0}/simpleInfo",
          getCompanyMemberList:webApiCompany+"/Company/{0}/Member/list",
          comfirmMember:webApiCompany+"/CompanyAdmin/{0}/Member/{1}/Comfirm",
          getRoleList:webApiCompany+"/Company/{0}/Role/List",
          getRole:webApiCompany+"/Company/{0}/Role/{1}",
          setDimission:webApiCompany+"/CompanyAdmin/{0}/Member/Dimission",
          addMember:webApiCompany+"/CompanyAdmin/{0}/Member",
          exitMember:webApiCompany+"/Company/{0}/Member/{1}",
          paramMember:webApiCompany+"/Company/{0}/Member/{1}",
          exitMemberRole:webApiCompany+"/CompanyAdmin/{0}/Member/{1}/Role",
          sendSMS:webApiCompany+"/Company/{0}/Member/{1}/sms/Invite",
          transferDepartment:webApiCompany+"/CompanyAdmin/{0}/department/{1}/Transfer",
          transferDepartmentForOne:webApiCompany+"/CompanyAdmin/{0}/Member/{1}/department",
          exitDepartment:webApiCompany+"/CompanyAdmin/{0}/department/{1}",
          getDepartmentInfo:webApiCompany+"/Company/{0}/department/{1}",
          addDepartment:webApiCompany+"/CompanyAdmin/{0}/department",
          deleteDepartment:webApiCompany+"/CompanyAdmin/{0}/department/{1}",
          deleteMember:webApiCompany+"/CompanyAdmin/{0}/Member/{1}",
          downloadCvs:webApiCompany+"/CompanyAdmin/{0}/Member/Cvs/Template",
          sendCvs:webApiCompany+"/CompanyAdmin/{0}/Member/Cvs",
          exportCvs:webApiCompany+"/ CompanyAdmin/{0}/Member/Cvs/Export",
          dissolutionCompany:webApiCompany+"/Company/{0}",
          setFunctionRange:webApiCompany+"/CompanyAdmin/{0}/Member/{1}/FunctionRange",
          setMemberArchives:webApiCompany+"/CompanyAdmin/{0}/Member/{1}/Archives",
          addRole:webApiCompany+"/CompanyAdmin/{0}/role",
          exitRole:webApiCompany+"/CompanyAdmin/{0}/role/{1}",
          deleteRole:webApiCompany+"/CompanyAdmin/{0}/role/{1}",
          batchJoinRole:webApiCompany+"/CompanyAdmin/{0}/role/{1}/Join",
          batchOutRole:webApiCompany+"/CompanyAdmin/{0}/role/{1}/Exit",
          outCompany:webApiCompany+"/Company/{0}/Member/{1}",
          getRoleFunction:webApiCompany+"/Company/{0}/role/{1}/Function",
          setRoleFunction:webApiCompany+"/CompanyAdmin/{0}/role/{1}/Function",
          getImagesCode:webApiCompany+"/ImagesCode/{0}?text={1}",
          fileUpload:webApiCompany+"/File/Upload?type={0}"
        },
        customer:{
          myCustomerList:webApiCustomer+"/Company/{0}/Member/{1}/Customer/List",
          getCustomerInfo:webApiCustomer+"/Company/{0}/Member/{1}/Customer/{2}",
          addCustomer:webApiCustomer+"/Company/{0}/Member/{1}/Customer",
          exitCustomer:webApiCustomer+"/Company/{0}/Member/{1}/Customer/{2}"
        }
      };
    }
  }]);
});
